<template>
  <div id="smellList">
    <div class="smellListContent">
      <div class="smellListContentHeader">
        <div class="smellListContentHeaderTab">
          <ul>
            <li v-for="(item, index) in classifyOne" :key="index" @click="headerTab(index)">
              <p :class="{blue: headerTabIndex === index}">{{item}}</p>
              <span v-show="headerTabIndex === index"></span>
            </li>
          </ul>
        </div>
        <div class="smellListContentHeaderSearch">
          <label for="searchStylist">
            <img src="../../assets/img/ideaMarket/sear.png" alt="">
            <input id="searchStylist" type="text" placeholder="请输入设计师昵称" v-model="stylistName" @keydown.enter="fetchSkillSelectRecommend(id)">
          </label>
          <button @click="fetchSkillSelectRecommend(id)" style="background:#15A29C;color:#fff">搜索</button>
        </div>
      </div>
    </div>
    <!-- <page-number
      :pageTotal="pageTotals"
      @prevPage="onPrevPage($event)"
      @pageActive="onPageActive($event)"
      @nextPage="onNextPage($event)"
      @pageChange="onPageChange($event)"
    ></page-number> -->
  </div>
</template>

<script>
export default {
  name: 'smellList',
  data () {
    return {
      classifyOne: [],
      headerTabIndex: 0
    }
  },
  created () {
    this.fetchSkillSelectLiterature()
  },
  methods: {
    // 切换tab和接口请求
    headerTab (val, id) {
      if (this.id === id) {
        return
      }
      this.id = id
      this.headerTabIndex = val
    },
    // 获取实战案例列表
    fetchSkillSelectLiterature () {
      this.$api.getSkillSelectLiterature({
      }).then(res => {
        console.log(res)
        if (res.code === 0) {
          console.log(res.data)
          res.data.forEach(r => {
            this.classifyOne.push(r.classifyName)
          });
          console.log(this.classifyOne)
        }
      })
    },
  }
}
</script>

<style lang="less" scoped>
#smellList{
  .smellListContent{
    width: 1200px;
    margin: auto;
    padding: .5rem 0;
    .smellListContentHeader{
      background-color: #fff;
      padding: .2rem;
      border-bottom: 1px solid #eee;
      font-size: 0;
      .smellListContentHeaderTab{
        display: inline-block;
        width: 70%;
        vertical-align: middle;
        border: 1px solid #fff;
        ul{
          li{
            position: relative;
            display: inline-block;
            height: .4rem;
            line-height: .4rem;
            margin-right: .1rem;
            p{
              font-size: 0.2rem;
              font-weight: 500;
              color: #333;
              line-height: .28rem;
            }
            .blue {
              color: #15a29c;
            }
            span{
              display: inline-block;
              width: 90%;
              height: .035rem;
              background-color: #15a29c;
              position: absolute;
              left: 50%;
              transform: translateX(-50%);
              bottom: 0;
            }
          }
        }
      }
      .smellListContentHeaderSearch{
        display: inline-block;
        width: 30%;
        text-align: right;
        vertical-align: middle;
        label{
          border: 1px solid #DCDFE6;
          border-radius: .05rem;
          height: .4rem;
          line-height: .4rem;
          display: inline-block;
          box-sizing: content-box;
          margin-right: .1rem;
          position: relative;
          input#searchStylist{
            display: inline-block;
            color: #606266;
            font-size: .16rem;
            font-weight: 500;
            line-height: .4rem;
            width: 2rem;
            height: 100%;
            padding: 0 .2rem;
            border-radius: .05rem;
            padding-left: .4rem;
          }
          img{
            position: absolute;
            left: .08rem;
            top: 50%;
            transform: translateY(-50%);
            display: inline-block;
            width: .25rem;
            height: .25rem;
            background-color: #fff;
            z-index: 100;
          }
        }
        button{
          outline: none;
          border: 1px solid #ccc;
          border-radius: .05rem;
          line-height: .4rem;
          padding: 0 .2rem;
          background-color: #fff;
          color: #333;
          font-size: .16rem;
          display: inline-block;
        }
      }
    }
  }
}
</style>
